package com.ess.project.examine.record.compute;

import java.util.HashMap;
import java.util.Map;

/**
 * @Description: 仰卧起坐
 * 超出100分后每递增2次增加1分,考核时间为2分钟。
 * @Date: Created in 7:45 下午 2021/3/7
 * @Author: daihui
 * @Modified By:
 */
public class SitupExamineStrategy implements BaseExamine<Integer> {

    private static final Map<Integer, Integer[]> MAN_DIC_DATA = new HashMap<>(13);
    private static final Map<Integer, Integer[]> WOMAN_DIC_DATA = new HashMap<>(13);

    /**
     * 字段数据
     */
    static {
        initDicData();
    }

    private static void initDicData(){
        Integer[] manGradeArray24 = {46, 50, 50, 54, 54, 58, 58, 62, 62, 67, 67, 72, 72, 77, 77, 82, 82, 87, 87, MAX_NUMBER};
        Integer[] manGradeArray2527 = {43, 47, 47, 51, 51, 55, 55, 59, 59, 63, 63, 67, 67, 72, 72, 77, 77, 82, 82, MAX_NUMBER};
        Integer[] manGradeArray2830 = {41, 45, 45, 49, 49, 53, 53, 57, 57, 61, 61, 65, 65, 70, 70, 75, 75, 80, 80, MAX_NUMBER};
        Integer[] manGradeArray3133 = {39, 43, 43, 47, 47, 51, 51, 55, 55, 59, 59, 63, 63, 68, 68, 73, 73, 78, 78, MAX_NUMBER};
        Integer[] manGradeArray3436 = {35, 39, 39, 43, 43, 47, 47, 51, 51, 55, 55, 60, 60, 65, 65, 70, 70, 75, 75, MAX_NUMBER};
        Integer[] manGradeArray3739 = {30, 35, 35, 40, 40, 45, 45, 49, 49, 54, 54, 59, 59, 64, 64, 69, 69, 74, 74, MAX_NUMBER};
        Integer[] manGradeArray4042 = {28, 33, 33, 38, 38, 41, 41, 46, 46, 51, 51, 56, 56, 61, 61, 66, 66, 71, 71, MAX_NUMBER};
        Integer[] manGradeArray4345 = {25, 30, 30, 35, 35, 39, 39, 44, 44, 49, 49, 54, 54, 59, 59, 64, 64, 69, 69, MAX_NUMBER};
        Integer[] manGradeArray4648 = {23, 28, 28, 33, 33, 37, 37, 42, 42, 47, 47, 51, 51, 56, 56, 61, 61, 66, 66, MAX_NUMBER};
        Integer[] manGradeArray4951 = {21, 26, 26, 32, 32, 35, 35, 39, 39, 44, 44, 48, 48, 53, 53, 58, 58, 63, 63, MAX_NUMBER};
        Integer[] manGradeArray5254 = {19, 24, 24, 29, 29, 33, 33, 37, 37, 42, 42, 46, 46, 51, 51, 56, 56, 61, 61, MAX_NUMBER};
        Integer[] manGradeArray5557 = {17, 22, 22, 26, 26, 31, 31, 35, 35, 39, 39, 44, 44, 49, 49, 54, 54, 59, 59, MAX_NUMBER};
        Integer[] manGradeArray5860 = {15, 17, 17, 22, 22, 27, 27, 32, 32, 37, 37, 42, 42, 47, 47, 52, 52, 57, 57, MAX_NUMBER};
        MAN_DIC_DATA.put(DATA_KEY_24, manGradeArray24);
        MAN_DIC_DATA.put(DATA_KEY_2527, manGradeArray2527);
        MAN_DIC_DATA.put(DATA_KEY_2830, manGradeArray2830);
        MAN_DIC_DATA.put(DATA_KEY_3133, manGradeArray3133);
        MAN_DIC_DATA.put(DATA_KEY_3436, manGradeArray3436);
        MAN_DIC_DATA.put(DATA_KEY_3739, manGradeArray3739);
        MAN_DIC_DATA.put(DATA_KEY_4042, manGradeArray4042);
        MAN_DIC_DATA.put(DATA_KEY_4345, manGradeArray4345);
        MAN_DIC_DATA.put(DATA_KEY_4648, manGradeArray4648);
        MAN_DIC_DATA.put(DATA_KEY_4951, manGradeArray4951);
        MAN_DIC_DATA.put(DATA_KEY_5254, manGradeArray5254);
        MAN_DIC_DATA.put(DATA_KEY_5557, manGradeArray5557);
        MAN_DIC_DATA.put(DATA_KEY_5860, manGradeArray5860);
        Integer[] womanGradeArray24 = {41, 42, 42, 43, 43, 53, 53, 56, 56, 59, 59, 62, 62, 65, 65, 68, 68, 71, 71, MAX_NUMBER};
        Integer[] womanGradeArray2527 = {38, 39, 39, 40, 40, 48, 48, 51, 51, 54, 54, 57, 57, 61, 61, 65, 65, 69, 69, MAX_NUMBER};
        Integer[] womanGradeArray2830 = {36, 37, 37, 38, 38, 47, 47, 50, 50, 53, 53, 56, 56, 59, 59, 63, 63, 67, 67, MAX_NUMBER};
        Integer[] womanGradeArray3133 = {34, 35, 35, 36, 36, 43, 43, 46, 46, 50, 50, 54, 54, 58, 58, 62, 62, 66, 66, MAX_NUMBER};
        Integer[] womanGradeArray3436 = {32, 33, 33, 34, 34, 40, 40, 44, 44, 48, 48, 52, 52, 56, 56, 60, 60, 64, 64, MAX_NUMBER};
        Integer[] womanGradeArray3739 = {29, 31, 31, 32, 32, 38, 38, 42, 42, 46, 46, 50, 50, 54, 54, 58, 58, 63, 63, MAX_NUMBER};
        Integer[] womanGradeArray4042 = {27, 29, 29, 30, 30, 35, 35, 39, 39, 43, 43, 47, 47, 52, 52, 57, 57, 62, 62, MAX_NUMBER};
        Integer[] womanGradeArray4345 = {27, 29, 29, 30, 30, 35, 35, 39, 39, 43, 43, 47, 47, 52, 52, 57, 57, 62, 62, MAX_NUMBER};
        Integer[] womanGradeArray4648 = {22, 25, 25, 26, 26, 30, 30, 35, 35, 40, 40, 45, 45, 50, 50, 55, 55, 60, 60, MAX_NUMBER};
        Integer[] womanGradeArray4951 = {19, 23, 23, 24, 24, 28, 28, 33, 33, 37, 37, 42, 42, 47, 47, 53, 53, 59, 59, MAX_NUMBER};
        Integer[] womanGradeArray5254 = {17, 21, 21, 22, 22, 25, 25, 29, 29, 34, 34, 39, 39, 45, 45, 51, 51, 57, 57, MAX_NUMBER};
        Integer[] womanGradeArray5557 = {15, 19, 19, 20, 20, 23, 23, 26, 26, 32, 32, 38, 38, 44, 44, 50, 50, 56, 56, MAX_NUMBER};
        Integer[] womanGradeArray5860 = {13, 17, 17, 18, 18, 20, 20, 23, 23, 30, 30, 35, 35, 42, 42, 48, 48, 55, 55, MAX_NUMBER};
        WOMAN_DIC_DATA.put(DATA_KEY_24, womanGradeArray24);
        WOMAN_DIC_DATA.put(DATA_KEY_2527, womanGradeArray2527);
        WOMAN_DIC_DATA.put(DATA_KEY_2830, womanGradeArray2830);
        WOMAN_DIC_DATA.put(DATA_KEY_3133, womanGradeArray3133);
        WOMAN_DIC_DATA.put(DATA_KEY_3436, womanGradeArray3436);
        WOMAN_DIC_DATA.put(DATA_KEY_3739, womanGradeArray3739);
        WOMAN_DIC_DATA.put(DATA_KEY_4042, womanGradeArray4042);
        WOMAN_DIC_DATA.put(DATA_KEY_4345, womanGradeArray4345);
        WOMAN_DIC_DATA.put(DATA_KEY_4648, womanGradeArray4648);
        WOMAN_DIC_DATA.put(DATA_KEY_4951, womanGradeArray4951);
        WOMAN_DIC_DATA.put(DATA_KEY_5254, womanGradeArray5254);
        WOMAN_DIC_DATA.put(DATA_KEY_5557, womanGradeArray5557);
        WOMAN_DIC_DATA.put(DATA_KEY_5860, womanGradeArray5860);
    }

    @Override
    public Integer compute(Object args, String gender, Integer... grade) {
        Integer[] arr;
        int age = (int) args;
        if (MAN.equals(gender)) {
            arr = MAN_DIC_DATA.get(BaseExamine.dicKey(age));
        } else {
            arr = WOMAN_DIC_DATA.get(BaseExamine.dicKey(age));
        }
        return BaseExamine.getScore(grade[0], EXAMINATION_ITEM_SITUP, arr);
    }
}
